﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="RolePermision.ascx.cs"
    Inherits="Portal.Administrator.Roles.RolePermision" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %>
<table border="0" cellpadding="2" cellspacing="2" class="InputBox" style="width: 100%">
    <tr>
        <td style="width: 15%">
            <asp:Label ID="lblRoles" runat="server" Text="Roles" meta:resourcekey="lblRolesResource1"
                Font-Bold="True"></asp:Label></td>
        <td colspan="2">
            <table width="100%" cellpadding="5" cellspacing="0">
                <tr>
                    <td style="width: 20%">
                        <asp:Label ID="lblPortal" runat="server" Text="Portal" meta:resourcekey="lblPortalResource1"
                            Font-Bold="True"></asp:Label>&nbsp;
                        <asp:DropDownList ID="dropPortal" runat="server" DataTextField="Portal_Name" DataValueField="PortalID"
                            AutoPostBack="True" meta:resourcekey="dropPortalResource1" Width="200px">
                        </asp:DropDownList></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td style="width: 15%; height: 719px; display:none;" valign="top">
            <asp:RadioButtonList ID="rdoRoles" Visible="false" runat="server" AutoPostBack="True" DataTextField="RoleName"
                DataValueField="RoleID" OnSelectedIndexChanged="rdoRoles_SelectedIndexChanged"
                meta:resourcekey="rdoRolesResource1">
            </asp:RadioButtonList></td>
        <td valign="top" style="height: 719px">
            <table width="100%">
                <tr>
                    <td align="left">
                        <asp:Label ID="lblCommands" runat="server" Text="Commands" meta:resourcekey="lblCommandsResource1"
                            Font-Bold="True"></asp:Label>
                        <asp:UpdatePanel ID="upanelUserPermission" runat="server" UpdateMode="Conditional"
                            RenderMode="Inline">
                            <Triggers>
                                <asp:asyncpostbacktrigger ControlID="btnUpdate" EventName="Click" />
                                <asp:asyncpostbacktrigger ControlID="dropPortal" EventName="SelectedIndexChanged" />
                                <asp:asyncpostbacktrigger ControlID="rdoRoles" EventName="SelectedIndexChanged" />
                            </Triggers>
                            <ContentTemplate>
                                <asp:ListBox ID="lstCommands" runat="server" Height="621px" SelectionMode="Multiple"
                                    Width="250px" meta:resourcekey="lstCommandsResource1"></asp:ListBox>
                                    <asp:Label ID="lblUpdate"
                                runat="server" meta:resourcekey="lblUpdateResource1" ForeColor="Blue" Font-Bold="True"></asp:Label>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Cập nhật"
                            CssClass="Button" meta:resourcekey="btnUpdateResource1" />
                    </td>
                </tr>
            </table>
        </td>
        <td style="width: 60%; height: 719px;" valign="top">
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <asp:UpdatePanel ID="upanelUserPermission1" runat="server" UpdateMode="Conditional"
                            RenderMode="Inline">
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="btnUpdate" EventName="Click" />
                                <asp:AsyncPostBackTrigger ControlID="btnUpdateAll" EventName="Click" />
                                <asp:AsyncPostBackTrigger ControlID="dropPortal" EventName="SelectedIndexChanged" />
                                <asp:AsyncPostBackTrigger ControlID="rdoRoles" EventName="SelectedIndexChanged" />
                            </Triggers>
                            <ContentTemplate>
                                <asp:DataGrid ID="dgrRolePermission" runat="server" AutoGenerateColumns="False" Width="100%"
                                    OnItemCommand="dgrRolePermission_ItemCommand" OnItemDataBound="dgrRolePermission_ItemDataBound"
                                    CellPadding="0" meta:resourcekey="dgrRolePermissionResource1">
                                    <Columns>
                                        <asp:BoundColumn DataField="RoleID" Visible="False" />
                                        <asp:BoundColumn DataField="CommandID" Visible="False" />
                                        <asp:BoundColumn DataField="PortalID" Visible="False" />
                                        <asp:TemplateColumn>
                                            <ItemStyle HorizontalAlign="Left" />
                                            <HeaderStyle Width="50%" HorizontalAlign="Left" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblCmdName" runat="server" meta:resourcekey="lblCmdNameResource1"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="Đọc">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkView" runat="server" meta:resourcekey="chkViewResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="Ghi">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkAdd" runat="server" meta:resourcekey="chkAddResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="Sửa">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkEdit" runat="server" meta:resourcekey="chkEditResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="Xóa">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkDelete" runat="server" meta:resourcekey="chkDeleteResource1" />
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn>
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:Button runat="server" CssClass="solidButton" ID="btnUpdate" Text="Update" CommandName="edit"
                                                    meta:resourcekey="btnUpdateResource2" />
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                    </Columns>
                                    <HeaderStyle BackColor="Desktop" HorizontalAlign="Center" ForeColor="White" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:DataGrid><asp:Label ID="lblUpdate1" runat="server" meta:resourcekey="lblUpdateResource1" ForeColor="Blue" Font-Bold="True"></asp:Label>
                            </ContentTemplate>
                             
                        </asp:UpdatePanel>
                        <asp:Button ID="btnUpdateAll" CssClass="Button" runat="server" Text="Cập nhật" OnClick="btnUpdateAll_Click"
                            meta:resourcekey="btnUpdateAllResource1" />
                       </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
